import { observable, computed, action } from 'mobx';
import { Element } from 'stores/models/core/nodeWithList';
import { stringExtendStyle } from 'common/utils/style';
import CONFIG from 'common/const/observer/video';

export default class Video extends Element {

  constructor(props) {
    super({
      ...props,
      icon: 'icon-image', // todo
      type: 'video',
      label: '视频',
    });

    let observableProps = {};
    CONFIG.forEach(item => {
      observableProps[item.key] = item.val;
    });
    // console.log(observableProps);
    this.init({
      observableProps
    });
  }


  @computed get style() {
    return {
      // poster: this.poster,
      width: this.width,
      height: this.height,
      top: this.top,
      left: this.left,
    };
  }

  @action controls() {
    this.isControls = !this.isControls;
  }
  @action loop() {
    this.isLoop = !this.isLoop;
  }
  @action autoplay() {
    this.isAutoplay = !this.isAutoplay;
  }

}
